Skip to main content

Registering Doctors via API

Authentication

This endpoint allows you to create doctors associated with your Medical Center. To start creating doctors, you must first obtain an authentication token. Make a POST request to the following endpoint, depending on your environment:

👨🏻‍💻 Development Environment:

POST https://api-dev.speaknosis.com/api/iam/integration/token

👨🏻‍💻 QA environment:

POST https://api-qa.speaknosis.com/api/iam/integration/token

🏥 Production Environment:

POST https://api-prod.speaknosis.com/api/iam/integration/token

Example Request Body (application/x-www-form-urlencoded):

grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

Code Example (JavaScript):

const loginDataObject = new URLSearchParams({
grant_type: "client_credentials",
client_id: "YOUR_CLIENT_ID",
client_secret: "YOUR_CLIENT_SECRET",
});

const requestOptions = {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: loginDataObject,
};

// Example using fetch API
fetch("YOUR_API_ENDPOINT", requestOptions)
.then(response => response.json())
.then(data => {
console.log('Token:', data.access_token);
// Store the access_token and use it in subsequent requests
})
.catch(error => console.error('Error fetching token:', error));

Remember to replace "YOUR_CLIENT_ID" and "YOUR_CLIENT_SECRET" with your provided credentials. Also, replace YOUR_API_ENDPOINT with the appropriate development or production URL.

The successful response (Code 200 OK) will contain the access_token in JSON format:

{
"access_token": "YOUR_ACCESS_TOKEN",
"token_type": "Bearer"
}

Creating Doctors

Once authenticated, you can proceed to register one or more doctors by making a POST request to the following endpoint, depending on your environment:

👨🏻‍💻 Development Environment:

POST https://api-dev.speaknosis.com/iam/v1/register/healthProviderDoctor

👨🏻‍💻 QA environment:

POST https://api-qa.speaknosis.com/iam/v1/register/healthProviderDoctor

🏥 Production Environment:

POST https://api-prod.speaknosis.com/iam/v1/register/healthProviderDoctor

Example Request Body (application/json):

In the request, you must send a JSON object containing a doctors key, whose value will be an array of objects, where each object represents a doctor to register. Be sure to include the access_token obtained in the previous step in the Authorization header of your request, using the Bearer scheme (e.g., Authorization: Bearer YOUR_ACCESS_TOKEN).

{
"doctors": [
{
"name": "Juan", // Doctor's first name.
"lastname": "Pérez", // Doctor's last name.
"email": "[email protected]", // (Optional) Doctor's email address in a valid format.
"doctorId": "DOC001", // Doctor's ID in the client's system. This ID can be the same one used internally.
"healthProviderId": 101, // This ID (healthProviderId) is provided by Speaknosis. Contact our support team if it has not yet been provided.
"doctorSpeciality": 3, // Doctor's specialty ID.
"lang": "es", // Doctor's language code (e.g., ES for Spanish, EN for English, CA for Catalan).
"doctorDictionary": "Paracetamol, Frontal Lobe, etc." // (Optional) Keywords or terms related to the doctor, separated by commas.
},
{
"name": "Laura",
"lastname": "García",
"email": "[email protected]",
"doctorId": "DOC002",
"healthProviderId": 101,
"doctorSpeciality": 7,
"lang": "en",
"doctorDictionary": "Ibuprofen, Tonsillitis, etc." // (Optional) Keywords for Dr. García.
}
]
}

To fill in the doctorSpeciality field, consult the Speaknosis list of specialties to see the available specialties and their respective IDs.

The successful response (Code 200 OK) will contain the following JSON response:

{
"success": true,
"message": "Doctor registered successfully",
"doctorId": "20" // Registered doctor's ID.
}